<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>登入 - layuiAdmin</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="lib/layui/v2.5.4/css/layui.css">
    <link rel="stylesheet" href="css/login/admin.css" media="all">
    <link rel="stylesheet" href="css/login/login.css" media="all">
</head>
<body>

<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>登录系统</h2>
            <p>登录系统</p>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                <input type="text" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input" value="账号">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input" value="密码">
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-xs7">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
                        <input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required" placeholder="图形验证码" class="layui-input" value="验证码">
                    </div>
                    <div class="layui-col-xs5">
                        <div style="margin-left: 10px;">
                            <img src="../../../captcha" class="layadmin-user-login-codeimg" id="login-captcha">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="margin-bottom: 20px;">
                <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
                <a href="forget.html" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
            </div>
            <div class="layui-trans layui-form-item layadmin-user-login-other">
                <label>社交账号登入</label>
                <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
                <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
                <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>

                <a href="reg.html" class="layadmin-user-jump-change layadmin-link">注册帐号</a>
            </div>
        </div>
    </div>

    <div class="layui-trans layadmin-user-login-footer">
        <p>© 2018 <a href="http://www.layui.com/" target="_blank">layui.com</a></p>
        <p>
        <span><a href="https://www.baidu.com" target="_blank">百度</a></span>
        <span><a href="https://www.taobao.com" target="_blank">淘宝</a></span>
        <span><a href="https://www.jd.com" target="_blank">京东</a></span>
        </p>
    </div>

    <div class="ladmin-user-login-theme">
        <script type="text/html" template>
            <ul>
                <li data-theme=""><img src="{{ layui.setter.base }}style/res/bg-none.jpg"></li>
                <li data-theme="#03152A" style="background-color: #03152A;"></li>
                <li data-theme="#2E241B" style="background-color: #2E241B;"></li>
                <li data-theme="#50314F" style="background-color: #50314F;"></li>
                <li data-theme="#344058" style="background-color: #344058;"></li>
                <li data-theme="#20222A" style="background-color: #20222A;"></li>
            </ul>
        </script>
    </div>

</div>

<script src="lib/layui/v2.5.4/layui.js?v=1.0.4"></script>
<script src="lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="lib/ajaxUtils.js"></script>
<script type="text/javascript">
    layui.use(['layer', 'form'], function () {
        var $ = layui.$,
            layer = layui.layer,
            form = layui.form;

        // 图形验证码
        $('#login-captcha').click(function () {
            this.src = '../../../captcha?t=' + (new Date).getTime();
        });

        form.render();

        //提交
        form.on('submit(LAY-user-login-submit)', function(obj) {
            // var params = {usersname:"username", password:"password"};
            // console.log("\n\n\n\n\n\n   "+typeof(params)+"  \n\n\n\n\n\n\n");
            // console.log("\n\n\n\n\n\n\n\n");
            // new AjaxPost({
            //     url: "../../v1/jquery-ajax/request-body",
            //     // bodyParams: params,
            //     success: function(data) {
            //         console.log(data);
            //     }
            // });

            console.log("===>>>"+JSON.stringify(obj.field))
            new AjaxGet({
                url: "../../../v1/jquery-ajax/get",
                urlParams: obj.field,
                success: function(data) {
                    console.log(data);
                }
            });


            new AjaxGet({
                url: "../../../v1/jquery-ajax/get",
                urlParams: obj.field,
                success: function(data) {
                    console.log(data);
                }
            });

            new AjaxPost({
                url: "../../../v1/jquery-ajax/post",
                bodyParams: obj.field,
                success: function(data) {
                    console.log(data);
                }
            });

/**
            new AjaxPut({
                url: "../../v1/jquery-ajax/request-body",
                bodyParams: JSON.stringify(obj.field),
                success: function(data) {
                    console.log(data);
                }
            });

            new AjaxDelete({
                url: "../../v1/jquery-ajax/request-body",
                bodyParams: JSON.stringify(obj.field),
                success: function(data) {
                    console.log(data);
                }
            });


            new AjaxPatch({
                url: "../../v1/jquery-ajax/request-body",
                bodyParams: JSON.stringify(obj.field),
                success: function(data) {
                    console.log(data);
                }
            });

            new Ajax({
                type: "POST",
                url: "../../v1/jquery-ajax/request-body",
                bodyParams: JSON.stringify(obj.field),
                success: function(data, status) {
                    console.log(data);
                    console.log(status);
                }
            });


            new Ajax({
                type: "POST",
                url: "../../v1/jquery-ajax/request-body",
                bodyParams: JSON.stringify(obj.field),
                success: function(data, status, XMLHttpRequest) {
                    console.log(XMLHttpRequest);
                    console.log("success : function(data, status, XMLHttpRequest)的XMLHttpRequest.status取值是====>>>> "+XMLHttpRequest.status);  // http请求响应的状态码
                    console.log("success : function(data, status, XMLHttpRequest)的XMLHttpRequest取值换行输出====>>>> ");
                    console.log(XMLHttpRequest);
                    console.log(XMLHttpRequest.getAllResponseHeaders());                                                                        // 响应头部
                }
            });

*/
            //
            // // 每次在控制台打印数据时,先换行,看起来数据整齐一点
            // console.log("\n\n\n\n\n\n\n\n");
            // // 发送异步请求
            // $.ajax({
            //     url : '../../v1/jquery-ajax/request-body',
            //     type : 'POST',
            //     data : JSON.stringify(obj.field),               // 表示转成json字符串, data: obj.field 参数都拼接到URL上面了
            //     contentType: "application/json; charset=UTF-8", // 设置请求参数以什么方式传输，如application/json，application/x-www-form-urlencoded，application/form-data
            //     dataType : 'json',   // 只能填json,text, 填了application/json或者类型不对的话的话, 就会进入error: function (XMLHttpRequest, textStatus, errorThrown)
            //     success : function(data, XMLHttpRequest) {  // dataType设置了json,返回的是json对象,可以通过点属性获取值
            //         console.log(data);
            //         // console.log("success : function(data, status, XMLHttpRequest)的status取值是====>>>> "+status);	                             // 输出的是 success 字符串
            //         console.log("success : function(data, status, XMLHttpRequest)的XMLHttpRequest.status取值是====>>>> "+XMLHttpRequest.status);  // http请求响应的状态码
            //         console.log("success : function(data, status, XMLHttpRequest)的XMLHttpRequest取值换行输出====>>>> ");
            //         console.log(XMLHttpRequest);
            //         console.log(XMLHttpRequest.getAllResponseHeaders());                                                                        // 响应头部
            //         console.log(JSON.stringify(data));
            //     },
            //     error: function (XMLHttpRequest, textStatus, errorThrown) {  // http状态码为500的请求, 会进入error方法
            //         // http请求响应的状态码
            //         console.log("error: function (XMLHttpRequest, textStatus, errorThrown)的XMLHttpRequest.status取值是====>>>> "+XMLHttpRequest.status);
            //         // http响应的数据
            //         console.log("error: function (XMLHttpRequest, textStatus, errorThrown)的XMLHttpRequest.responseText取值是====>>>> "+XMLHttpRequest.responseText);
            //         console.log(JSON.parse(XMLHttpRequest.responseText));
            //         console.log("error: function (XMLHttpRequest, textStatus, errorThrown)的XMLHttpRequest取值换行输出====>>>> ");
            //         console.log(XMLHttpRequest);
            //     },
            //     complete: function(XMLHttpRequest, textStatus) {
            //         this; // 调用本次AJAX请求时传递的options参数
            //     }
            // });


            // $.ajax({
            //     url : '../../v1/jquery-ajax/request-body',
            //     type : 'POST',
            //     data : JSON.stringify(obj.field),               // 表示转成json字符串, data: obj.field 参数都拼接到URL上面了
            //     contentType: "application/json; charset=UTF-8", // 设置请求参数以什么方式传输，如application/json，application/x-www-form-urlencoded，application/form-data
            //     dataType : 'json',   // 只能填json,text, 填了application/json或者类型不对的话的话, 就会进入error: function (XMLHttpRequest, textStatus, errorThrown)
            //     success : function(data, status, XMLHttpRequest) {  // dataType设置了json,返回的是json对象,可以通过点属性获取值
            //         console.log("success : function(data, status, XMLHttpRequest)的status取值是====>>>> "+status);	                             // 输出的是 success 字符串
            //         console.log("success : function(data, status, XMLHttpRequest)的XMLHttpRequest.status取值是====>>>> "+XMLHttpRequest.status);  // http请求响应的状态码
            //         console.log("success : function(data, status, XMLHttpRequest)的XMLHttpRequest取值换行输出====>>>> ");
            //         console.log(XMLHttpRequest);
            //         console.log(XMLHttpRequest.getAllResponseHeaders());                                                                        // 响应头部
            //         console.log(JSON.stringify(data));
            //     },
            //     error: function (XMLHttpRequest, textStatus, errorThrown) {  // http状态码为500的请求, 会进入error方法
            //         // http请求响应的状态码
            //         console.log("error: function (XMLHttpRequest, textStatus, errorThrown)的XMLHttpRequest.status取值是====>>>> "+XMLHttpRequest.status);
            //         // http响应的数据
            //         console.log("error: function (XMLHttpRequest, textStatus, errorThrown)的XMLHttpRequest.responseText取值是====>>>> "+XMLHttpRequest.responseText);
            //         console.log(JSON.parse(XMLHttpRequest.responseText));
            //         console.log("error: function (XMLHttpRequest, textStatus, errorThrown)的XMLHttpRequest取值换行输出====>>>> ");
            //         console.log(XMLHttpRequest);
            //     },
            //     complete: function(XMLHttpRequest, textStatus) {
            //         this; // 调用本次AJAX请求时传递的options参数
            //     }
            // });
        });
    });
</script>
</body>
</html>